package com.minimalist.common.entity.lindi.vo.tradeapplicationoperator;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;


import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标平台_交易指标申请操作实体
 *
 * @author 11987
 */
@Schema(name = "林地指标平台_交易指标申请操作实体")
public class LindiTradeApplicationOperatorVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    // ========== 基本信息 ==========

    @NotNull(message = "交易指标申请操作ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "tradeApplicationOperatorId", description = "交易指标申请操作ID", type = "string")
    private Long tradeApplicationOperatorId;

    @Schema(name = "content", description = "操作内容", type = "string")
    private String content;

    @Schema(name = "creatorName", description = "创建人", type = "string")
    private String creatorName;

    // ========== 审计字段 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @Schema(name = "createName", description = "创建人姓名", type = "string")
    private String createName;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "createTime", description = "创建时间", type = "string")
    private LocalDateTime createTime;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "updateTime", description = "更新时间", type = "string")
    private LocalDateTime updateTime;

    public LindiTradeApplicationOperatorVO() {
    }

    public LindiTradeApplicationOperatorVO(Long tradeApplicationOperatorId, String content, String creatorName, Long createId, String createName, LocalDateTime createTime, Long updateId, LocalDateTime updateTime) {
        this.tradeApplicationOperatorId = tradeApplicationOperatorId;
        this.content = content;
        this.creatorName = creatorName;
        this.createId = createId;
        this.createName = createName;
        this.createTime = createTime;
        this.updateId = updateId;
        this.updateTime = updateTime;
    }

    public Long getTradeApplicationOperatorId(){
        return tradeApplicationOperatorId;
    }

    public void setTradeApplicationOperatorId(Long tradeApplicationOperatorId){
        this.tradeApplicationOperatorId = tradeApplicationOperatorId;
    }

    public String getContent(){
        return content;
    }

    public void setContent(String content){
        this.content = content;
    }

    public String getCreatorName(){
        return creatorName;
    }

    public void setCreatorName(String creatorName){
        this.creatorName = creatorName;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public String getCreateName(){
        return createName;
    }

    public void setCreateName(String createName){
        this.createName = createName;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiTradeApplicationOperatorVO that = (LindiTradeApplicationOperatorVO) o;
        return Objects.equals(tradeApplicationOperatorId, that.tradeApplicationOperatorId)
                && Objects.equals(content, that.content)
                && Objects.equals(creatorName, that.creatorName)
                && Objects.equals(createId, that.createId)
                && Objects.equals(createName, that.createName)
                && Objects.equals(createTime, that.createTime)
                && Objects.equals(updateId, that.updateId)
                && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(tradeApplicationOperatorId, content, creatorName, createId, createName, createTime, updateId, updateTime);
    }

    @Override
    public String toString(){
        return "LindiTradeApplicationOperatorVO{" +
                "tradeApplicationOperatorId=" + tradeApplicationOperatorId +
                ", content='" + content + '\'' +
                ", creatorName='" + creatorName + '\'' +
                ", createId=" + createId +
                ", createName='" + createName + '\'' +
                ", createTime=" + createTime +
                ", updateId=" + updateId +
                ", updateTime=" + updateTime +
                '}';
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Long tradeApplicationOperatorId;
        private String content;
        private String creatorName;
        private Long createId;
        private String createName;
        private LocalDateTime createTime;
        private Long updateId;
        private LocalDateTime updateTime;

        public Builder tradeApplicationOperatorId(Long tradeApplicationOperatorId) {
            this.tradeApplicationOperatorId = tradeApplicationOperatorId;
            return this;
        }

        public Builder content(String content) {
            this.content = content;
            return this;
        }

        public Builder creatorName(String creatorName) {
            this.creatorName = creatorName;
            return this;
        }

        public Builder createId(Long createId) {
            this.createId = createId;
            return this;
        }

        public Builder createName(String createName) {
            this.createName = createName;
            return this;
        }

        public Builder createTime(LocalDateTime createTime) {
            this.createTime = createTime;
            return this;
        }

        public Builder updateId(Long updateId) {
            this.updateId = updateId;
            return this;
        }

        public Builder updateTime(LocalDateTime updateTime) {
            this.updateTime = updateTime;
            return this;
        }

        public LindiTradeApplicationOperatorVO build() {
            return new LindiTradeApplicationOperatorVO(
                    tradeApplicationOperatorId,
                    content,
                    creatorName,
                    createId,
                    createName,
                    createTime,
                    updateId,
                    updateTime
            );
        }
    }
}
